﻿using System.Web.Mvc;
using reDoo.Data;

namespace reDoo.Web.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        private IProjectRepository projectRepository;

        public HomeController(IProjectRepository projectRepository)
        {
            this.projectRepository = projectRepository;
        }

        public ActionResult Index()
        {
            if (this.HttpContext.User.Identity.IsAuthenticated)
            {
                var projects = projectRepository.GetAll();
                return View("IndexAuth", projects);
            }

            return View();
        }

    }
}